function [t_sim1, t_sim2, loss] = LPtrain(p_train, t_train, p_test, Eta, MaxTrainNumber)

%%  设置参数
loss   = [];                  % 损失函数存储
lad    = size(p_train, 2);    % 输入样本数
InDim  = size(p_train, 1);    % 输入样本维数
OutDim = size(t_train, 1);    % 输出目标维数

%%  模型训练

WExpand = rand(InDim, OutDim);                            % 权值初始化        
for i = 1 : MaxTrainNumber                                % 循环MaxTrainNumber次
    for p = 1 : lad
        net(:, p) = WExpand' * p_train(:, p);             % 计算样本p的net值
        out(:, p) = sigmoid(net(:, p));                   % 调用编辑好的变换函数，得到输出值
        Err(:, p) = out(:, p) - t_train(:, p);            % 计算误差
        WExpand  = WExpand + Eta.* p_train(:, p) * (t_train(:, p) - net(:, p))';
                                                          % 根据误差更新权值
    end
    Err_sum = sum(abs(sum(abs(Err(:, p)))));              % 计算总误差
    loss = [loss, Err_sum];                               % 累计损失函数
    if Err_sum <= 1e-10                                   % 判断训练是否停止
        break
    end
end

%%  验证
t_sim1 = sigmoid(WExpand' * p_train);
t_sim2 = sigmoid(WExpand' * p_test );

end